# -*- coding: utf-8 -*-
import random
import re
import uuid

randomstr = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'


def get_first_matching_group_by_pattern(string, reg):
    matchObj = re.findall(reg, string)
    if len(matchObj) > 0:
        return matchObj[0]
    return ''


def random_string(length=16):
    return ''.join(random.sample(randomstr, length))


def uid():
    return str(uuid.uuid4())
